﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.SharePoint.Client
{

    public static class CommonExtensions
    {

        public static T Find<T>(this IEnumerable<T> extendee, Predicate<T> predicate)
        {
            foreach (var i in extendee)
            {
                if (predicate(i))
                {
                    return i;
                }
            }
            return default(T);
        }

        public static string Multiply(this string extendee, int count)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < count; i++)
            {
                sb.Append(extendee);
            }
            return sb.ToString();
        }

    }

}